Hello, this is my first attempt at creating a website, and my first real experience with Python.
I am receiving an error that is not present in the "Web Development with Python 2" video. It appears as though "webapp" and a few other functions are undefined (there is a squiggly line underneath the word). Even keywords like "backends.sqlite" - contained in the settings.py container appear undefined.
Included within my problem is the return I receive after trying to "runserver" following the creation of the webapp (included below).
I have to add that I have rewatched the first two videos three times and triple checked all of my spelling to match what you have written in your videos. Can you think of a reason why I am unable to successfully launch the website?
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x00000288D4D03598> Traceback (most recent call last): File "C:UserskevinAppDataLocalProgramsPythonPython35libsite-packagesdjangoutilsautoreload.py", line 226, in wrapper fn(*args, **kwargs) File "C:UserskevinAppDataLocalProgramsPythonPython35libsite-packagesdjangocoremanagementcommandsrunserver.py", line 116, in inner_run self.check(display_num_errors=True) File "C:UserskevinAppDataLocalProgramsPythonPython35libsite-packagesdjangocoremanagementbase.py", line 426, in check include_deployment_checks=include_deployment_checks, File "C:UserskevinAppDataLocalProgramsPythonPython35libsite-packagesdjangocorechecksregistry.py", line 75, in run_checks new_errors = check(app_configs=app_configs) File "C:UserskevinAppDataLocalProgramsPythonPython35libsite-packagesdjangocorechecksurls.py", line 10, in check_url_config return check_resolver(resolver) File "C:UserskevinAppDataLocalProgramsPythonPython35libsite-packagesdjangocorechecksurls.py", line 19, in check_resolver for pattern in resolver.url_patterns: File "C:UserskevinAppDataLocalProgramsPythonPython35libsite-packagesdjangoutilsfunctional.py", line 33, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "C:UserskevinAppDataLocalProgramsPythonPython35libsite-packagesdjangocoreurlresolvers.py", line 417, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "C:UserskevinAppDataLocalProgramsPythonPython35libsite-packagesdjangoutilsfunctional.py", line 33, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "C:UserskevinAppDataLocalProgramsPythonPython35libsite-packagesdjangocoreurlresolvers.py", line 410, in urlconf_module return import_module(self.urlconf_name) File "C:UserskevinAppDataLocalProgramsPythonPython35libimportlib__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 986, in _gcd_import File "<frozen importlib._bootstrap>", line 969, in _find_and_load File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 673, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 662, in exec_module File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed File "C:UserskevinDesktopMysitemysitemysiteurls.py", line 22, in <module> url(r'^webapp/', include ('webapp.urls')) File "C:UserskevinAppDataLocalProgramsPythonPython35libsite-packagesdjangoconfurls__init__.py", line 52, in include urlconf_module = import_module(urlconf_module) File "C:UserskevinAppDataLocalProgramsPythonPython35libimportlib__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 986, in _gcd_import File "<frozen importlib._bootstrap>", line 969, in _find_and_load File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 673, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 662, in exec_module File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed File "C:UserskevinDesktopMysitemysitewebappurls.py", line 5, in <module> url(r'^$', views.index, name=index)] NameError: name 'index' is not defined
You must be logged in to post. Please login or register an account.
Check the views file, and see if you have an index defined. Maybe it was a typo, or maybe it really doesn't exist. Either way, django is claiming it cant find it there.
-Harrison 8 years ago
You must be logged in to post. Please login or register an account.
This is what I have in views.py. However, "from django.shortcuts..." is greyed out. It's telling me that I have "Unused import statement"
I'm using Pythong 3.5.1 on PyCharm. I'm wondering if this may be a problem?
from django.shortcuts import render from django.http import HttpResponse